package com.ruoyi.yljf.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.yljf.mapper.MedicalNoticeMapper;
import com.ruoyi.yljf.domain.MedicalNotice;
import com.ruoyi.yljf.service.IMedicalNoticeService;

import javax.annotation.Resource;

/**
 * 医案笔记Service业务层处理
 * 
 * @author metaee
 * @date 2025-03-26
 */
@Service
public class MedicalNoticeServiceImpl extends ServiceImpl<MedicalNoticeMapper, MedicalNotice> implements IMedicalNoticeService {
    @Resource
    private MedicalNoticeMapper medicalNoticeMapper;
    
    /**
     * 查询医案笔记列表
     * 
     * @param medicalNotice 医案笔记
     * @return 医案笔记
     */
    @Override
    public List<MedicalNotice> selectMedicalNoticeList(MedicalNotice medicalNotice) {
    	LambdaQueryWrapper<MedicalNotice> queryWrapper = Wrappers.lambdaQuery();
        if (StringUtils.isNotNull(medicalNotice.getUserId())) {
			queryWrapper.eq(MedicalNotice::getUserId, medicalNotice.getUserId());
		}
        if (StringUtils.isNotEmpty(medicalNotice.getUserName())) {
			queryWrapper.like(MedicalNotice::getUserName, medicalNotice.getUserName());
		}
        if (StringUtils.isNotEmpty(medicalNotice.getAvatar())) {
			queryWrapper.eq(MedicalNotice::getAvatar, medicalNotice.getAvatar());
		}
        if (StringUtils.isNotNull(medicalNotice.getCurId())) {
			queryWrapper.eq(MedicalNotice::getCurId, medicalNotice.getCurId());
		}
        if (StringUtils.isNotEmpty(medicalNotice.getName())) {
			queryWrapper.like(MedicalNotice::getName, medicalNotice.getName());
		}
        if (StringUtils.isNotEmpty(medicalNotice.getNoticeContent())) {
			queryWrapper.eq(MedicalNotice::getNoticeContent, medicalNotice.getNoticeContent());
		}
        if (StringUtils.isNotNull(medicalNotice.getLikes())) {
			queryWrapper.eq(MedicalNotice::getLikes, medicalNotice.getLikes());
		}
        if (StringUtils.isNotNull(medicalNotice.getCreatTime())) {
			queryWrapper.eq(MedicalNotice::getCreatTime, medicalNotice.getCreatTime());
		}
        return medicalNoticeMapper.selectList(queryWrapper);
    }
}
